<template>
	<view class="monitor">
		<view class="tab">
			<view :class="currentVal == 0?'tab_item activeTab':'tab_item'" @click="currentVal=0;tabIndex=0">运行监测分析
			</view>
			<view :class="currentVal == 1?'tab_item activeTab':'tab_item'" @click="currentVal=1;tabIndex=1">货运量通道分析
			</view>
			<!-- <view :class="currentVal == 2?'tab_item activeTab':'tab_item'" @click="currentVal=2;tabIndex=2">安全风险评估
			</view> -->
		</view>
		<!-- <swiper class="swiper"  :autoplay="true"
				:duration="duration">
				<swiper-item>
					<view class="swiper-item uni-bg-red">A</view>
				</swiper-item>
				<swiper-item>
					<view class="swiper-item uni-bg-green">B</view>
				</swiper-item>
				<swiper-item>
					<view class="swiper-item uni-bg-blue">C</view>
				</swiper-item>
			</swiper> -->

		<view class="cont">
			<swiper :duration="duration" @change="swiperChange" :current="currentVal">
				<!-- //运行监测分析 -->
				<swiper-item>
					<Card />
				</swiper-item>
				<!-- //货运量通道分析 -->
				<swiper-item>
					<scroll-view scroll-y="true" class="scroll">
						<Goods />
					</scroll-view>
				</swiper-item>
				<!-- //安全风险评估 -->
				<swiper-item>
					<risk />
				</swiper-item>
			</swiper>

		</view>

	</view>
</template>

<script>
	import {
		cargoFlowCount,
		cargoAnalogyFlow
	} from '@/common/api/monitor.js'
	import Card from './cardOne.vue'
	import Goods from './goodsCharts.vue'
	import risk from './risk.vue'

	export default {
		components: {
			Card,
			Goods,
			risk
		},
		data() {
			return {
				duration: 500,
				currentVal: 0,
				tabIndex: 0,
			};
		},
		mounted() {

		},
		methods: {
			swiperChange(e) {
				console.log(e.detail.current);
				this.currentVal = e.detail.current
				this.tabIndex = e.detail.current
			},
		},

	}
</script>

<style lang="scss" scoped>
	page {
		width: 100%;
		height: 100%;
	}

	.paddingItem {
		padding: 10rpx 20rpx;
		width: calc(100% - 40rpx);
	}

	.monitor {
		width: 100%;
		height: 100%;

		.tab {
			width: calc(100% - 40rpx);
			padding: 0 20rpx;
			height: 80rpx;
			display: flex;
			align-items: center;
			color: #333333;
			font-size: 30rpx;
			position: relative;

			.tab_item {
				padding: 0 18rpx;
				height: 70rpx;
				line-height: 70rpx;
				text-align: center;
			}

			.activeTab {
				color: #196CC6;
				position: relative;
			}

			.activeTab::after {
				content: '';
				position: absolute;
				width: calc(100% - 40rpx);
				height: 2rpx;
				bottom: 10rpx;
				left: 20rpx;
				background-color: #196CC6;
			}
		}

		.tab::before {
			content: '';
			position: absolute;
			width: 4rpx;
			height: 30rpx;
			background-color: #1590EF;
			top: 25rpx;
			left: 15rpx;
		}

		.cont {
			height: calc(100% - 100rpx);

			swiper {
				height: calc(100vh - 166rpx);

				.scroll {
					height: 100%;
				}
			}

			.swiper {
				height: 100%;
				background-color: pink;
				// .scroll {
				// 	height: 100%;
				// }
			}

			.ccc_line {
				width: 100%;
				height: 2rpx;
				background-color: #F0F0F0;
				margin: 10rpx 0;
			}

		}
	}
</style>
